package com.test.proxy.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * Created by qinjian on 2018/11/1.
 */
public class PersonHandler implements InvocationHandler {
    private Object obj;

    public PersonHandler(Object object) {
        this.obj = object;
    }

    /**
     * 代理对象
     */
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("before");
        Object result = method.invoke(obj, args);
        System.out.println("after");
        return result;
    }
}
